<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>重庆大学硕士研究生服务系统</title>
<?php $this->load->view('includes/ga_head'); ?>  
</head>
<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> 
<body class=""> 
<!--<![endif]-->
<?php $this->load->view('includes/ga_navbar'); ?>  
<?php $this->load->view('includes/ga_sidebar'); ?>  
<div class="content">
    <div class="header">
        <h1 class="page-title">我的推免申请信息维护</h1>
    </div>
    <ul class="breadcrumb">
        <li><a href="<?php echo $base_url;?>gass_news/all_public_news">学生面板</a> <span class="divider">/</span></li>
        <li class="active">推免申请信息详情</li>
    </ul>
    <div class="container-fluid">
        <div class="row-fluid">
<?php $this->load->view('includes/ga_message'); ?>  
<?php echo form_open(current_url());?>  	
<div class="input-append">
    <input  type="submit" id="sav_submit" class="btn span2" name= "save_form_submit" value="保存"  />
    <input  type="submit" id="sub_submit" class="btn span2" name= "submit_form_submit" value="提交"  />
</div>
<div class="well">
        <input type="hidden" name="applyId" value=<?php echo (empty($applyInfo))?'unsaved':$applyInfo['apply_id'];  ?> />
        <table class="table table-striped table-hover ">
  	<tr><td>申请状态</td>
  		<td>
  		<?php 
  		  if (empty($applyInfo)){
  		  	echo '尚未保存';
  		  	$currentApplyStatus = 0;
  		  }else{
  		  	foreach ( $gassApplyStatus as $gas){
  		  		if($gas[0]==$applyInfo['apply_status']){
  		  			echo $gas[1];
  		  			$currentApplyStatus = $gas[0];
  		  		}
  		  	}
  			}
  		?>
  		</td>
  		<input type="hidden" id="applyStatusId" name="applyStatus" value=<?php echo $currentApplyStatus;  ?> />	
        <td>审批回执</td>
  		<td style="color:red">
  		<?php
  		if (empty($applyInfo)){
  			echo '无';
  		}else{
  			echo $applyInfo['apply_feedback'];
  		}	 
  	  ?>
  		</td>
  	</tr>
        <tr><td>招生宣传会:</td>
            <td>
				  <select id="xxbsm" name="update_xxbsm" >
				  	<option value ="unselected" >请选择</option>
			    	<?php foreach ( $gassRecruitCodeList as $grcl ){ ?>
			    	<option value = <?php echo $grcl['activity_id'] ?> <?php if(!empty($applyInfo)) echo ($grcl['activity_id']==$applyInfo['identifying_code'])?'selected':''; ?> ><?php echo $grcl['activity_alias'] ?></option>
			    	<?php } ?>
				  </select>				  
            </td>
            <td>研招网报名号:</td>
            <td>
			<input title="在国家研招网报名成功后填写" type="text" id="bmh" name="update_bmh" value="<?php echo set_value('update_bmh',(empty($applyInfo))?'':$applyInfo['statue_reg_num']);?>" />
            </td></tr>
        <tr><td>申请类型:</td>
            <td>
					<select id="apptype" name="select_apptype" >
			    	<?php foreach ( $gassApplyTypeList as $gatl ){ ?>
			    	<option value = <?php echo $gatl[0] ?> <?php if(!empty($applyInfo)) echo ($gatl[0]==$applyInfo['apply_type'])?'selected':''; ?> ><?php echo $gatl[1] ?></option>
			    	<?php } ?>
				  </select>				  
            </td>
            <td>推免资格:</td>
            <td>
				<select id="recom_qualify" name="select_recom_qualify"  >
			    	<option value = 1 >已取得</option>   	
			    	<option value = 2 <?php if(!empty($applyInfo)) echo (2==$applyInfo['recom_qualify'])?'selected':''; ?> >未取得</option>
			    </select>	
            </td></tr>
			<div id="adjust" <?php if(!empty($applyInfo)) echo ($applyInfo['apply_type']==3)?"":"style='display:none'";else echo "style='display:none'"; ?>>
        <tr><td>考生编号:</td>
            <td>
			  <input type="text" id="examinee_num" name="update_examinee_num" value="<?php echo set_value('update_examinee_num',(empty($applyInfo))?'':$applyInfo['stu_exam_num']);?>" />
            </td>
            <td>初始总分:</td>
            <td>
			  <input type="text" id="total_points" name="update_total_points" value="<?php echo set_value('update_total_points',(empty($applyInfo))?'':$applyInfo['stu_total_points']);?>" />
            </td></tr>
        <tr><td>政治分数:</td>
            <td>
			  <input type="text" id="political_points" name="update_political_points" value="<?php echo set_value('update_political_points',(empty($applyInfo))?'':$applyInfo['stu_political']);?>" />
            </td>
            <td>外国语分数:</td>
            <td>
			  <input type="text" id="foreign_language" name="update_foreign_language" value="<?php echo set_value('update_foreign_language',(empty($applyInfo))?'':$applyInfo['stu_foreign']);?>" />
            </td></tr>
        <tr><td>业务课一分数:</td>
            <td>
			  <input type="text" id="business_one" name="update_business_one" value="<?php echo set_value('update_business_one',(empty($applyInfo))?'':$applyInfo['stu_bus_one']);?>" />
            </td>
            <td>业务课二分数:</td>
            <td>
			  <input type="text" id="business_two" name="update_business_two" value="<?php echo set_value('update_business_two',(empty($applyInfo))?'':$applyInfo['stu_bus_two']);?>" />
            </td></tr>
        <tr><td>一志愿报考专业代码:</td>
            <td>
			  <input type="text" placeholder="必须和网上报名专业代码一致" id="initial_major" name="update_initial_major" value="<?php echo set_value('update_initial_major',(empty($applyInfo))?'':$applyInfo['stu_init_major']);?>" />
            </td>
            <td></td>
            <td>
            </td></tr>
			</div>	
        <tr><td>真实姓名:</td>
            <td>
			  <input type="text" id="true_name" name="update_true_name" value="<?php echo set_value('update_true_name',(empty($applyInfo))?'':$applyInfo['stu_real_name']);?>" />
            </td>
            <td>性别:</td>
            <td>
<select id="gender" name="select_gender" >
			    	<?php foreach ( $gassXbmList as $xml ){ ?>
			    	<option value = <?php echo $xml[0]; ?> <?php if(!empty($applyInfo)) echo ($xml[0]==$applyInfo['stu_gender'])?'selected':''; ?> ><?php echo $xml[1]; ?></option>
			    	<?php } ?>
				  </select>
            </td></tr>
        <tr><td>民族:</td>
            <td>
				<select id="nation" name="update_nation" >
			    	<?php foreach ( $gassMzmList as $gml ){ ?>
			    	<option value = <?php echo $gml[0]; ?> <?php if(!empty($applyInfo)) echo ($gml[0]==$applyInfo['stu_nation'])?'selected':''; ?> ><?php echo $gml[1]; ?></option>
			    	<?php } ?>
				</select>	
            </td>
            <td>政治面貌:</td>
            <td>
				<select id="politics_status" name="update_politics_status" >
			    	<?php foreach ( $gassZZmmmList as $gzl ){ ?>
			    	<option value = <?php echo $gzl[0]; ?> <?php if(!empty($applyInfo)) echo ($gzl[0]==$applyInfo['politics_status'])?'selected':''; ?> ><?php echo $gzl[1]; ?></option>
			    	<?php } ?>
				</select>	
            </td></tr>
        <tr><td>证件类型:</td>
            <td>
				<select id="id_type" name="update_id_type" >
			    	<?php foreach ( $gassZjlxmList as $gzjl ){ ?>
			    	<option value = <?php echo $gzjl[0]; ?> <?php if(!empty($applyInfo)) echo ($gzjl[0]==$applyInfo['certificate_type'])?'selected':''; ?> ><?php echo $gzjl[1]; ?></option>
			    	<?php } ?>
				</select>	
            </td>
            <td>证件号码:</td>
            <td>
				<input type="text" id="id_num" name="update_id_num" value="<?php echo set_value('update_id_num',(empty($applyInfo))?'':$applyInfo['certificate_num']);?>" />
            </td></tr>
        <tr><td>毕业学校:</td>
            <td>
				<select id="undergraduate_school" name="update_undergraduate_school" >
			    	<?php foreach ( $gassBydwmList as $gbdl ){ ?>
			    	<option value = <?php echo $gbdl['bydwdm']; ?> <?php if(!empty($applyInfo)) echo ($gbdl['bydwdm']==$applyInfo['ungra_school'])?'selected':''; ?> ><?php echo $gbdl['bydwmc']; ?></option>
			    	<?php } ?>
				</select>	
            </td>
            <td>本科毕业专业:</td>
            <td>
				<input type="text" id="undergraduate_major" name="update_undergraduate_major" value="<?php echo set_value('update_undergraduate_major',(empty($applyInfo))?'':$applyInfo['ungra_major']);?>" />
            </td></tr>
        <tr><td>本科学号:</td>
            <td>
				<input type="text" id="undergraduate_id" name="update_undergraduate_id" value="<?php echo set_value('update_undergraduate_id',(empty($applyInfo))?'':$applyInfo['ungra_num']);?>" />
            </td>
            <td>本科毕业年份:</td>
            <td>
				<input type="text" id="undergraduate_date" name = "update_undergraduate_date" value="<?php echo set_value('update_undergraduate_date',(empty($applyInfo))?'':date_create_from_format('Y-m-d',substr($applyInfo['gra_date'],0,10))->format('m/d/Y'));?>" readonly="readonly" />
            </td></tr>
        <tr><td>考生来源:</td>
            <td>
				<select id="stu_from" name="update_stu_from" >
			    	<?php foreach ( $gassKslymList as $gkml ){ ?>
			    	<option value = <?php echo $gkml[0]; ?> <?php if(!empty($applyInfo)) echo ($gkml[0]==$applyInfo['stu_from'])?'selected':''; ?> ><?php echo $gkml[1]; ?></option>
			    	<?php } ?>
				</select>	
            </td>
            <td>平均成绩:</td>
            <td>
				<input type="text" id="avg_score" name= "update_avg_score" value="<?php echo set_value('update_avg_score',(empty($applyInfo))?'':$applyInfo['stu_avg_score']);?>" />
            </td></tr>
        <tr><td>外语四级成绩:</td>
            <td>
			    <input type="text" id="level_4_score" name="update_level_4_score" value="<?php echo set_value('update_level_4_score',(empty($applyInfo))?'':$applyInfo['stu_cet4_score']);?>" />
            </td>
            <td>外语六级成绩:</td>
            <td>
			  <input type="text" id="level_6_score" name="update_level_6_score" value="<?php echo set_value('update_level_6_score',(empty($applyInfo))?'':$applyInfo['stu_cet6_score']);?>" />
            </td></tr>
        <tr><td>班级排名:</td>
            <td>
			  <input title="名次/班级人数" type="text" id="class_ranking" name="update_class_ranking" value="<?php echo set_value('update_class_ranking',(empty($applyInfo))?'':$applyInfo['stu_class_rank']);?>" />
            </td>
            <td>专业排名:</td>
            <td>
			   <input title="名次/年级同专业人数" type="text" id="grade_ranking" name="update_grade_ranking" value="<?php echo set_value('update_grade_ranking',(empty($applyInfo))?'':$applyInfo['stu_major_rank']);?>" />
            </td></tr>
        <tr><td>联系电话:</td>
            <td>
			    <input type="text" id="telephone" name="update_telephone" value="<?php echo set_value('update_telephone',(empty($applyInfo))?'':$applyInfo['stu_telephone']);?>" />
            </td>
            <td>移动电话:</td>
            <td>
			    <input type="text" id="cellphone" name="update_cellphone" value="<?php echo set_value('update_cellphone',(empty($applyInfo))?'':$applyInfo['stu_cellphone']);?>" />
            </td></tr>
        <tr><td>报考院系:</td>
            <td>
				<select id="apply_collage" name="update_apply_collage" >
					  <option value ="unselected" >请选择</option>
			    	<?php foreach ( $gassBkyxsmList as $gbsl ){ ?>
			    	<option value = <?php echo $gbsl['college_id'];?> <?php if(!empty($applyInfo)) echo ($gbsl['college_id']==$applyInfo['apply_college'])?'selected':''; ?> ><?php echo $gbsl['college_name']; ?></option>
			    	<?php } ?>
				</select>	
            </td>
            <td>报考专业:</td>
            <td>
				<select id="apply_major" name="update_apply_major" >
					<?php if(!empty($applyInfo)){?>
					<option  value = <?php echo $applyInfo['apply_major']; ?> ><?php echo $this->gass_global_model->get_cmt_array_by_series($applyInfo['apply_major'],1); ?></option>
					<option value = 1 >未选择</option>
					<?php }else{ ?>
					<option value = 1 >未选择</option>
					<?php } ?>
				</select>	
            </td></tr>
        <tr><td>报考导师姓名:</td>
            <td>
				<select id="tutor" name="update_tutor" >
					<?php if(!empty($applyInfo)){?>
					<option  value = <?php echo $applyInfo['tutor_id']; ?> >
						<?php echo $this->gass_global_model->get_cmt_array_by_series($applyInfo['tutor_id'],2);
						 ?></option>
					<option value = 1 >未选择</option>
					<?php }else{ ?>
					<option value = 1 >未选择</option>
					<?php } ?>
				</select>				  
            </td>
            <td></td>
            <td>
            </td></tr>
        <tr><td>通信地址及邮编:</td>
            <td>
				<input style=" width:400px; " type="text" id="address" name="update_address" value="<?php echo set_value('update_address',(empty($applyInfo))?'':$applyInfo['stu_address']);?>" />
            </td>
            <td></td>
            <td>
            </td></tr>
        <tr><td>报考原因:</td>
            <td>
				<input style=" width:400px; " type="text" id="register_reason" name="update_register_reason" value="<?php echo set_value('update_register_reason',(empty($applyInfo))?'':$applyInfo['stu_reg_reason']);?>" />
            </td>
            <td></td>
            <td>
            </td></tr>
        <tr><td>奖惩情况:</td>
            <td>
				<textarea style=" width:400px; " id="description" name="update_description" ><?php echo set_value('update_description',(empty($applyInfo))?'':$applyInfo['stu_description']);?></textarea>
            </td>
            <td></td>
            <td>
            </td></tr>
        <tr><td>学习工作经历:</td>
            <td>
				<textarea style=" width:400px; " id="work_description" name="update_work_description" ><?php echo set_value('update_work_description',(empty($applyInfo))?'':$applyInfo['stu_experience']);?></textarea>
            </td>
            <td></td>
            <td>
            </td></tr>
        </table>
</div>
	  <?php echo form_close();?>
<?php $this->load->view('includes/ga_footer'); ?>  
        </div>
    </div>
</div>
<?php $this->load->view('includes/ga_scripts'); ?>
<script src="<?php echo $includes_dir;?>js/ui/i18n/jquery.ui.datepicker-zh-CN.js"></script>
<script>
$(document).ready(function(){
//只有推免申请才能选择是否获取资格 
$('#apptype').change(function(){
	switch ($('#apptype').val()){
		case '02':
		  $('#rq_lable')[0].style.display='none';
		  $('#adjust')[0].style.display='none';
		  $('#recom_qualify')[0].value = 2;    
		  break;
		case '01':
		  $('#rq_lable')[0].style.display='';
		  $('#adjust')[0].style.display='none';
		  $('#recom_qualify')[0].value = 1;
		  break;
		case '03':
		  $('#rq_lable')[0].style.display='none';
		  $('#adjust')[0].style.display='';
		  $('#recom_qualify')[0].value = 2;
		  break;
	}
});
//思路：当选择完之后，进行遮罩；后台ajax,成功之后，解除遮罩。
$('#apply_collage').change(function(){
	jsRemoveItemFromSelect($("#apply_collage")[0],"unselected");
	$.blockUI({ 
		  css: {
      border: 'none',
      padding: '15px',
      backgroundColor: '#000',
      '-webkit-border-radius': '10px',
      '-moz-border-radius': '10px',
      opacity: .5,
      color: '#fff'
      } 
  }); 
  $.ajax({
     type:"post",
     data: "collegeId=" + $("#apply_collage").val(),
     url: "<?php echo base_url();?>gass_auth_students/get_major_list",
     success: function(data){
         var jsObject = eval('('+data+')');        
         $("#apply_major")[0].options.length = 0; 
         $("#tutor")[0].options.length = 0; 
         jsAddItemToSelect($("#apply_major")[0],'尚未选择',1);
         for(var i=0;i<jsObject.length;i++) {
         	  jsAddItemToSelect($("#apply_major")[0],jsObject[i].major_name,jsObject[i].major_id);
         }
         //$("#apply_major")[0].value = 1;
         //$("#tutor")[0].value = 1;
         setTimeout($.unblockUI, 20);
     },
     error: function(){
         //$("#loading_message").hide();
         alert("获取数据失败，请与网站管理员联系！");
         setTimeout($.unblockUI, 20);
     }
  }); 
  
});
//选择专业，显示对应的导师
$('#apply_major').change(function(){
	jsRemoveItemFromSelect($("#apply_major")[0],1);
	$.blockUI({ 
		  css: {
      border: 'none',
      padding: '15px',
      backgroundColor: '#000',
      '-webkit-border-radius': '10px',
      '-moz-border-radius': '10px',
      opacity: .5,
      color: '#fff'
      } 
  }); 
  $.ajax({
     type:"post",
     data: "majorId=" + $("#apply_major").val()+"&collegeId=" + $("#apply_collage").val(),
     url: "<?php echo base_url();?>gass_auth_students/get_tutor_list",
     success: function(data){
         
         var jsObject = eval('('+data+')');        
         $("#tutor")[0].options.length = 0;  
         for(var i=0;i<jsObject.length;i++) {
         	  jsAddItemToSelect($("#tutor")[0],jsObject[i].tutor_name,jsObject[i].tutor_id);
         }
         
         setTimeout($.unblockUI, 20);
         //alert(data);
     },
     error: function(){
         //$("#loading_message").hide();
         alert("获取数据失败，请与网站管理员联系！");
         setTimeout($.unblockUI, 20);
     }
  }); 
  
});
//&& $('#sav_submit').attr("disabled")=='disabled'

//对提交操作的限制，保存操作暂时无限制。
if ( ($('#applyStatusId').val()>1 && $('#applyStatusId').val()<5 )||$('#applyStatusId').val()==0){
  $( "#sub_submit" )[0].disabled=true;
}

//当已经提交，且没有被退回的情况下，则无法编辑已上报的内容；除了国家报名号可以在后来填写。
if ($('#applyStatusId').val()>1 && $('#applyStatusId').val()<5 ){
	$("input[type=text],textarea,select").each(function(i){
    $(this).attr("disabled",'disabled');
  });
}
$('#bmh').attr("disabled",false);
$( "#undergraduate_date" ).datepicker();
});

</script>
</script>
</body>
</html>
